const path = require('path');
const webpack = require('webpack')
const HtmlPlugin = require("html-webpack-plugin")
module.exports = {
    entry: path.join(__dirname, "./src/main.js"),
    output: {
        path: path.resolve(__dirname, "./dist"),
        filename: "[name].js"
    },
    module: {
        rules: [{
                test: /\.js$/,
                loader: "babel-loader",
                options: {
                    presets: ["@babel/preset-env"]
                }
            },
            // ,{
            //     test: /\.(png|jpg|gif|svg)$/,
            //     loader:"url-loader",
            //     options:{
            //         limit:3333
            //     }
            // }
            //scss
            {
                test:/\.scss$/,
                use:
            }
        ]
    },
    devServer: { //起服务
        port: 9999,
        open: true,
        hot: true //热更新
    },
    plugins: [
        new HtmlPlugin({
            template: "./index.html",
            filename: "index.html"
        }),
        new webpack.HotModuleReplacementPlugin() //热更新

    ]
}